package exception_exercise;

public class ThrowDemo2 {
    public static void main(String[] args) {
        Student2 ls=new Student2();
        try{
            ls.setAge2(100);
            System.out.println("此人年龄为:"+ls.getAge2()+"岁。");
        }catch (RuntimeException e2){
            System.out.println("年龄不合法");
        }
    }
}
